<template>
	<view class="recommend-content">
		<image src="https://cdn.uviewui.com/uview/swiper/swiper1.png" class="recommend-image" mode=""></image>
		<view class="content">
			<view class="content-title">新品推荐</view>
			<view class="content-content">
				<view class="content-box" v-for="(item,index) in recommendData" :key="index" @click="newCommodity">
					<image :src="item.src" class="content-image" mode=""></image>
					<view class="content-name">{{ item.name}}</view>
					<view class="content-font">
						<text class="font-laft">￥{{ item.discount }}</text>
						<text class="font-right">￥{{ item.original }}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 新品推荐数据
				recommendData:[
					{ src:'https://cdn.uviewui.com/uview/swiper/swiper2.png',name:'测试测试',discount:'20', original:'34' },
					{ src:'https://cdn.uviewui.com/uview/swiper/swiper2.png',name:'测试测试',discount:'20', original:'34' },
					{ src:'https://cdn.uviewui.com/uview/swiper/swiper2.png',name:'测试测试',discount:'20', original:'34' }
				]
			}
		},
		methods: {
			newCommodity(){
				uni.navigateTo({
					url:'/pages/index/productDetails/productDetails'
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		background-color: rgb(246, 246, 246);
		padding: 0rpx 20rpx 0rpx 20rpx;
	}
	.recommend-image {
		width: 100%;
		height: 400rpx;
	}
	
	.content-title {
		text-align: center;
		font-size: 40rpx;
	}
	
	.content-content{
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		margin-top: 40rpx;
	}
	
	.content-box{
		width: 49%;
		background-color: #fff;
		margin-bottom: 40rpx;
	}
	
	.content-image{
		width: 100%;
		height: 400rpx;
		border-radius: 20rpx;
	}
	
	.content-name{
		font-size: 40rpx;
	}
	
	.content-font{
		margin-top: 40rpx;
	}
	
	.font-laft{
		font-size: 35rpx;
		color: red;
	}
	
	
	.font-right{
		
		text-decoration: line-through;
		color: #ccc;
	}
</style>
